﻿<UserControl x:Class="WpfDemoControlLibrary.PersonUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="265" Width="323">
    <Grid>
        <Label Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="label2" VerticalAlignment="Top" Width="120">Name</Label>
        <TextBox Height="23" Margin="110,10,12,0" Name="txtName" VerticalAlignment="Top" Text="{Binding Path=Name,Mode=TwoWay}"/>
        <Label Height="23" Margin="10,39,0,0" Name="label1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">Firstname</Label>
        <TextBox Height="23" Margin="110,39,12,0" Name="txtFirstname" VerticalAlignment="Top" Text="{Binding Path=Firstname,Mode=TwoWay}"/>
        <Label Height="28" Margin="12,68,0,0" Name="label3" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">Nationality</Label>
        <ComboBox Height="23" Margin="110,68,12,0" Name="cmbNationality" VerticalAlignment="Top" ItemsSource="{Binding Path=Countries}" SelectedValue="{Binding Path=Nationality,Mode=TwoWay}" />
        <Button Margin="110,102,77,0" Name="btnAdd" Height="23" VerticalAlignment="Top" Click="btnAdd_Click">Add</Button>
        <my:DataGrid ItemsSource="{Binding Persons}"  AutoGenerateColumns="False" Margin="12,0,12,12" Name="dataGrid" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" IsReadOnly="True" Height="112" VerticalAlignment="Bottom">
            <my:DataGrid.Columns>
                <my:DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="100" />
                <my:DataGridTextColumn Binding="{Binding Firstname}" Header="Firstname" Width="90" />
                <my:DataGridTextColumn Binding="{Binding Nationality}" Header="Nationality" Width="100" />
            </my:DataGrid.Columns>
        </my:DataGrid>        
    </Grid>
</UserControl>
